package com.oocl.factory;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import com.oocl.util.DBUtil;
import com.oocl.util.DBUtilTest;
import com.oocl.util.DBUtil_JNDI;

public class DBConFactory {
	private static Connection con;
	
	public static Connection getConnection(){
//		con = DBUtil_JNDI.getConnection();
		con = DBUtil.createConnectionWithDataSource();
//		con = DBUtilTest.createConnection();
		return con;
	}
	
	/**
	 * @param con
	 * @param pst
	 * @param rs
	 */
	public static void close(Connection con, Statement pst, ResultSet rs){
		try {
			if(rs != null)
				rs.close();
			if(pst != null)
				pst.close();
			if(con != null)
				con.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
	}

	
}
